/*
 * Copyright (c) 2024 vitasystems GmbH
 *
 * This file is part of project EHRbase Migration Tool
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.ehrbase.migration.importer.v4.jooq.pg.tables.records;

import java.time.OffsetDateTime;
import java.util.UUID;
import org.ehrbase.migration.importer.v4.jooq.pg.enums.ContributionChangeType;
import org.ehrbase.migration.importer.v4.jooq.pg.tables.AuditDetails;
import org.jooq.Field;
import org.jooq.JSONB;
import org.jooq.Record1;
import org.jooq.Record7;
import org.jooq.Row7;
import org.jooq.impl.UpdatableRecordImpl;

/**
 * This class is generated by jOOQ.
 */
@SuppressWarnings({"all", "unchecked", "rawtypes", "this-escape"})
public class AuditDetailsRecord extends UpdatableRecordImpl<AuditDetailsRecord>
        implements Record7<UUID, ContributionChangeType, String, OffsetDateTime, JSONB, UUID, String> {

    private static final long serialVersionUID = 1L;

    /**
     * Setter for <code>ehr.audit_details.id</code>.
     */
    public void setId(UUID value) {
        set(0, value);
    }

    /**
     * Getter for <code>ehr.audit_details.id</code>.
     */
    public UUID getId() {
        return (UUID) get(0);
    }

    /**
     * Setter for <code>ehr.audit_details.change_type</code>.
     */
    public void setChangeType(ContributionChangeType value) {
        set(1, value);
    }

    /**
     * Getter for <code>ehr.audit_details.change_type</code>.
     */
    public ContributionChangeType getChangeType() {
        return (ContributionChangeType) get(1);
    }

    /**
     * Setter for <code>ehr.audit_details.description</code>.
     */
    public void setDescription(String value) {
        set(2, value);
    }

    /**
     * Getter for <code>ehr.audit_details.description</code>.
     */
    public String getDescription() {
        return (String) get(2);
    }

    /**
     * Setter for <code>ehr.audit_details.time_committed</code>.
     */
    public void setTimeCommitted(OffsetDateTime value) {
        set(3, value);
    }

    /**
     * Getter for <code>ehr.audit_details.time_committed</code>.
     */
    public OffsetDateTime getTimeCommitted() {
        return (OffsetDateTime) get(3);
    }

    /**
     * Setter for <code>ehr.audit_details.committer</code>.
     */
    public void setCommitter(JSONB value) {
        set(4, value);
    }

    /**
     * Getter for <code>ehr.audit_details.committer</code>.
     */
    public JSONB getCommitter() {
        return (JSONB) get(4);
    }

    /**
     * Setter for <code>ehr.audit_details.user_id</code>.
     */
    public void setUserId(UUID value) {
        set(5, value);
    }

    /**
     * Getter for <code>ehr.audit_details.user_id</code>.
     */
    public UUID getUserId() {
        return (UUID) get(5);
    }

    /**
     * Setter for <code>ehr.audit_details.target_type</code>.
     */
    public void setTargetType(String value) {
        set(6, value);
    }

    /**
     * Getter for <code>ehr.audit_details.target_type</code>.
     */
    public String getTargetType() {
        return (String) get(6);
    }

    // -------------------------------------------------------------------------
    // Primary key information
    // -------------------------------------------------------------------------

    @Override
    public Record1<UUID> key() {
        return (Record1) super.key();
    }

    // -------------------------------------------------------------------------
    // Record7 type implementation
    // -------------------------------------------------------------------------

    @Override
    public Row7<UUID, ContributionChangeType, String, OffsetDateTime, JSONB, UUID, String> fieldsRow() {
        return (Row7) super.fieldsRow();
    }

    @Override
    public Row7<UUID, ContributionChangeType, String, OffsetDateTime, JSONB, UUID, String> valuesRow() {
        return (Row7) super.valuesRow();
    }

    @Override
    public Field<UUID> field1() {
        return AuditDetails.AUDIT_DETAILS.ID;
    }

    @Override
    public Field<ContributionChangeType> field2() {
        return AuditDetails.AUDIT_DETAILS.CHANGE_TYPE;
    }

    @Override
    public Field<String> field3() {
        return AuditDetails.AUDIT_DETAILS.DESCRIPTION;
    }

    @Override
    public Field<OffsetDateTime> field4() {
        return AuditDetails.AUDIT_DETAILS.TIME_COMMITTED;
    }

    @Override
    public Field<JSONB> field5() {
        return AuditDetails.AUDIT_DETAILS.COMMITTER;
    }

    @Override
    public Field<UUID> field6() {
        return AuditDetails.AUDIT_DETAILS.USER_ID;
    }

    @Override
    public Field<String> field7() {
        return AuditDetails.AUDIT_DETAILS.TARGET_TYPE;
    }

    @Override
    public UUID component1() {
        return getId();
    }

    @Override
    public ContributionChangeType component2() {
        return getChangeType();
    }

    @Override
    public String component3() {
        return getDescription();
    }

    @Override
    public OffsetDateTime component4() {
        return getTimeCommitted();
    }

    @Override
    public JSONB component5() {
        return getCommitter();
    }

    @Override
    public UUID component6() {
        return getUserId();
    }

    @Override
    public String component7() {
        return getTargetType();
    }

    @Override
    public UUID value1() {
        return getId();
    }

    @Override
    public ContributionChangeType value2() {
        return getChangeType();
    }

    @Override
    public String value3() {
        return getDescription();
    }

    @Override
    public OffsetDateTime value4() {
        return getTimeCommitted();
    }

    @Override
    public JSONB value5() {
        return getCommitter();
    }

    @Override
    public UUID value6() {
        return getUserId();
    }

    @Override
    public String value7() {
        return getTargetType();
    }

    @Override
    public AuditDetailsRecord value1(UUID value) {
        setId(value);
        return this;
    }

    @Override
    public AuditDetailsRecord value2(ContributionChangeType value) {
        setChangeType(value);
        return this;
    }

    @Override
    public AuditDetailsRecord value3(String value) {
        setDescription(value);
        return this;
    }

    @Override
    public AuditDetailsRecord value4(OffsetDateTime value) {
        setTimeCommitted(value);
        return this;
    }

    @Override
    public AuditDetailsRecord value5(JSONB value) {
        setCommitter(value);
        return this;
    }

    @Override
    public AuditDetailsRecord value6(UUID value) {
        setUserId(value);
        return this;
    }

    @Override
    public AuditDetailsRecord value7(String value) {
        setTargetType(value);
        return this;
    }

    @Override
    public AuditDetailsRecord values(
            UUID value1,
            ContributionChangeType value2,
            String value3,
            OffsetDateTime value4,
            JSONB value5,
            UUID value6,
            String value7) {
        value1(value1);
        value2(value2);
        value3(value3);
        value4(value4);
        value5(value5);
        value6(value6);
        value7(value7);
        return this;
    }

    // -------------------------------------------------------------------------
    // Constructors
    // -------------------------------------------------------------------------

    /**
     * Create a detached AuditDetailsRecord
     */
    public AuditDetailsRecord() {
        super(AuditDetails.AUDIT_DETAILS);
    }

    /**
     * Create a detached, initialised AuditDetailsRecord
     */
    public AuditDetailsRecord(
            UUID id,
            ContributionChangeType changeType,
            String description,
            OffsetDateTime timeCommitted,
            JSONB committer,
            UUID userId,
            String targetType) {
        super(AuditDetails.AUDIT_DETAILS);

        setId(id);
        setChangeType(changeType);
        setDescription(description);
        setTimeCommitted(timeCommitted);
        setCommitter(committer);
        setUserId(userId);
        setTargetType(targetType);
        resetChangedOnNotNull();
    }
}
